package org.csmzxy.class2333;
import java.util.Scanner;
public class 数组查找 {
    public static void main(String[] args){
        Scanner sca = new Scanner(System.in);
        String[] arr1 = {"平民","狼人","女巫","猎人","预言家"};
        //字符串比较要用equals
        int tidai = -1;
        System.out.println("猜一下您是什么身份：");
        String a = sca.next();
        for(int i = 0; i < arr1.length; i++){
            if (a.equals(arr1[i])){
                tidai = i;
                System.out.println("您猜对了,在第"+tidai+"个位置");
                break;
            }
        }
        if (tidai == -1){
            System.out.println("您猜错了");
        }
    }
}
